<?php
class PerformanceController extends AppController
{
    var $uses = array();
    var $helpers = array('Calendar');

    public function index()
    {
        $this->redirect('arrival');
    }

    public function arrival($userId = null, $year = null, $month = null)
    {
        $this->set("modul","activity");
        $this->set("submodul","performance");

        $data = array();
        $showCalendar = false;
        if(!$year) {
            $year = date('Y');
        }
        if(!$month) {
            $month = date('m');
        }
        if($userId) {
            $data = ClassRegistry::init('Performance')->getArrivalData($userId, $year, $month);
            $showCalendar = true;
        }

        $users = ClassRegistry::init('User')->find('list');
        $this->set(compact('data', 'users', 'year', 'month', 'userId', 'showCalendar'));
    }
}
?>
